package ru.ssau.university.persistence.dao;

import java.util.List;

import org.hibernate.Query;

import ru.ssau.hibernate.util.AbstractDAO;
import ru.ssau.university.persistence.entity.Student;

public class StudentDAO extends AbstractDAO<Student>{
	public StudentDAO() {
		this.objectClass = Student.class;
	}
	
	@SuppressWarnings("unchecked")
	public List<Student> getStudentsByGroup(Long groupId) {
		Query q = createQuery("select s from Student s where s.group.id=:groupId order by s.fullName");
		q.setLong("groupId", groupId);
		return q.list();
	}
}
